package com.learn.FunctionalInterface;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;

/**
 * Consumer  就是只有入参无返回值的Fucntion  主要就是传参做内部逻辑
 *
 * 只有入参 DoubleConsumer IntConsumer LongConsumer  指定入参类型
 * 多个入参 BiConsumer
 * 指定第二个入参类型  ObjDoubleConsumer ObjIntConsumer ObjLongConsumer
 *
 * andthen 就是先执行后调用  入参也是Consumer
 */
public class ConsumerDemo {
    public static void main(String[] args) {
        Map<String, Integer> salaries = new HashMap<>();
        salaries.put("alice", 100);
        salaries.put("jack", 200);
        salaries.put("mark", 300);
        salaries.forEach((k,v)-> System.out.println("键："+k+" 值:"+(v*10)) );

        Consumer<String> consumer = (o)->System.out.println(o);
        Consumer<String> con = (o)->System.out.println(o+" after!");
        //andthen
        consumer.andThen(con).accept("hello Consumer!");
    }
}
